package cn.admin.configcenter.registry.common.util;

import java.util.Iterator;

public final class ReadonlyIterator<E> implements Iterator<E> {

	private final Iterator<E> delegate;

	private ReadonlyIterator(Iterator<E> _iter) {
		this.delegate = _iter;
	}

	public static <E> Iterator<E> wrap(Iterator<E> iter) {
		return new ReadonlyIterator<E>(iter);
	}

	@Override
	public boolean hasNext() {
		return this.delegate.hasNext();
	}

	@Override
	public E next() {
		return this.delegate.next();
	}

	public void remove() {
		throw new UnsupportedOperationException();
	}
}
